GBML manual / Effects

effect_start_room

Like effect_start, but the ROOM owns the system instead of the instance: it keeps running after the instance that started it is destroyed, and stops when the room changes or restarts.

Works differently on Game Boy - The Game Boy draws 10 sprites on one line, so a room has 10 particles alive at a time, and they are drawn solid, without turning or changing size.

Works differently on Game Boy Color - The Game Boy Color draws 10 sprites on one line, so a room has 10 particles alive at a time, and they are drawn solid, without turning or changing size.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

effect_start_room(sys, x, y)

Arguments

NameType
syseffect
xreal
yreal

Returns

Nothing.

Description

Like effect_start, but the room owns the running system instead of the instance. That means it keeps running after the instance that started it is destroyed, and it ends when the room changes or restarts.

x and y are a place in the room, counted from the room's top-left corner, exactly as for effect_start (including the one exception for camera-space effects, which that page explains).

When to use it

Use it for something that should outlive whatever lit it: a bonfire that keeps burning after the match is gone, smoke that rises from a crate that was just smashed. For anything that should end when its instance does - a torch on a wall, a trail behind a car - use effect_start instead.

The same rules as effect_start

Example

effect_start_room(fx_doc_spark, x, y);

Starts the spark effect at this instance's own position and hands it to the room. Destroy the instance afterwards and the sparks keep going.

On the GBA

Use it for something that should outlive whatever lit it - a bonfire that keeps burning after the match is gone. The room can run one copy of each effect, so asking again for the same effect moves it. Any instance can put it out with effect_stop. It takes one of the same 6 running-system slots as effect_start does, and gives it back when the room changes or restarts. Every particle is a real hardware sprite, so a burst spends from the same 128-sprite ceiling everything else on screen is using. The engine caps itself rather than overrunning it (max_effect_particles/max_effect_systems_live, engine/include/gbml/config.h) and an over-budget spawn is quietly dropped - never an error, never a crash, so a too-generous burst thins out instead of breaking. The GBA has no per-sprite alpha, so `fade_out` is faked by flickering a particle off on alternating frames as it dies, not by dissolving it. A rotated or scaled particle wants a hardware affine matrix, of which there are only 32 for the whole screen: past the effect budget the engine falls back to a shared quantized matrix, then to plain flips.

See also: Particles and lightingeffect_starteffect_stopeffect_burst